# Python 2.6.4
# Project Euler, Problem 57
# Copyright 2010 Talha Zaman

num, den, count = 3, 2, 0
for i in range(1000):
    if len(str(num)) > len(str(den)): count += 1
    num, den = 2*den+num, num+den
print count
